package com.cvo.scrumtoolkit.client.pannels;

import com.cvo.scrumtoolkit.client.entities.BacklogItem;
import com.cvo.scrumtoolkit.client.entities.Sprint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class SprintBacklogOverviewPanel extends Composite {

	private static SprintOverviewPanelUiBinder uiBinder = GWT
			.create(SprintOverviewPanelUiBinder.class);

	interface SprintOverviewPanelUiBinder extends
			UiBinder<Widget, SprintBacklogOverviewPanel> {
	}
	private Sprint sprint;
	
	@UiField
	Label sprintNummer;
	@UiField
	ScrollPanel scrollPanel;
	@UiField
	VerticalPanel verticalPanel;
	
	

	public SprintBacklogOverviewPanel(Sprint sprint) {
		loadDummyData(sprint);
		initWidget(uiBinder.createAndBindUi(this));
		this.sprint =sprint;
		this.sprintNummer.setText(sprint.getSprintNummer().toString());
		for(BacklogItem bl : this.sprint.getBacklogItems()){
			//TODO: Do stuff, add line
		}
	}

	private void loadDummyData(Sprint sprint) {
		
		final BacklogItem backlogItem = new BacklogItem();
		final BacklogItem backlogItem1 = new BacklogItem();
		final BacklogItem backlogItem2 = new BacklogItem();
		final BacklogItem backlogItem3 = new BacklogItem();
		final BacklogItem backlogItem4 = new BacklogItem();
		
		backlogItem.setBacklogItemName("backlogitem");
		backlogItem1.setBacklogItemName("backlogitem1");
		backlogItem2.setBacklogItemName("backlogitem2");
		backlogItem3.setBacklogItemName("backlogitem3");
		backlogItem4.setBacklogItemName("backlogitem4");
		
		sprint.addBacklogItem(backlogItem);
		sprint.addBacklogItem(backlogItem1);
		sprint.addBacklogItem(backlogItem2);
		sprint.addBacklogItem(backlogItem3);
		sprint.addBacklogItem(backlogItem4);
		
		
		
	}

}
